home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / rawfile.inc < prev    next >
Encoding:
Text File  |  1997-01-16  |  7.2 KB  |  249 lines

  1. ;*      RAWFILE.INC
  2. ;*
  3. ;* Raw file I/O for MIDAS Sound System
  4. ;*
  5. ;* $Id: rawfile.inc,v 1.3 1997/01/16 18:41:59 pekangas Exp $
  6. ;*
  7. ;* Copyright 1996,1997 Housemarque Inc.
  8. ;*
  9. ;* This file is part of the MIDAS Sound System, and may only be
  10. ;* used, modified and distributed under the terms of the MIDAS
  11. ;* Sound System license, LICENSE.TXT. By continuing to use,
  12. ;* modify or distribute this file you indicate that you have
  13. ;* read the license and understand and accept it fully.
  14. ;*
  15.  
  16.  
  17. ;/***************************************************************************\
  18. ;*       struct rfFile
  19. ;*       -------------
  20. ;* Description:  File state structure
  21. ;\***************************************************************************/
  22.  
  23. STRUC   rfFile
  24.         D_int   handle
  25. ENDS
  26.  
  27.  
  28.  
  29. ;/***************************************************************************\
  30. ;*       typedef rfHandle
  31. ;*       ----------------
  32. ;* Description: Raw file I/O file handle
  33. ;\***************************************************************************/
  34.  
  35. TYPEDEF rfHandle dword
  36.  
  37.  
  38.  
  39.  
  40. ;/***************************************************************************\
  41. ;*       enum rfOpenMode
  42. ;*       ---------------
  43. ;* Description:  File opening mode. Used by rfOpen()
  44. ;\***************************************************************************/
  45.  
  46. ENUM    rfOpenMode \
  47.         rfOpenRead = 1, \               ; open file for reading
  48.         rfOpenWrite = 2, \              ; open file for writing
  49.         rfOpenReadWrite = 3             ; open file for both reading and
  50.                                         ; writing
  51.  
  52.  
  53.  
  54. ;/***************************************************************************\
  55. ;*       enum rfSeekMode
  56. ;*       ---------------
  57. ;* Description:  File seeking mode. Used by rfSeek()
  58. ;\***************************************************************************/
  59.  
  60. ENUM    rfSeekMode \
  61.         rfSeekAbsolute = 1, \           ; seek to an absolute position from
  62.                             \           ; the beginning of the file
  63.         rfSeekRelative = 2, \           ; seek to a position relative to
  64.                             \           ; current position
  65.         rfSeekEnd = 3                   ; seek relative to the end of file
  66.  
  67.  
  68.  
  69. ;/***************************************************************************\
  70. ;*
  71. ;* Function:     int rfOpen(char *fileName, int openMode, rfHandle *file);
  72. ;*
  73. ;* Description:  Opens a file for reading or writing
  74. ;*
  75. ;* Input:        char *fileName          name of file
  76. ;*               int openMode            file opening mode, see enum rfOpenMode
  77. ;*               rfHandle *file          pointer to file handle
  78. ;*
  79. ;* Returns:      MIDAS error code.
  80. ;*               File handle is stored in *file.
  81. ;*
  82. ;\***************************************************************************/
  83.  
  84. GLOBAL  LANG rfOpen : _funct
  85.  
  86.  
  87.  
  88.  
  89. ;/***************************************************************************\
  90. ;*
  91. ;* Function:     int rfClose(rfHandle file);
  92. ;*
  93. ;* Description:  Closes a file opened with rfOpen().
  94. ;*
  95. ;* Input:        rfHandle file           handle of an open file
  96. ;*
  97. ;* Returns:      MIDAS error code
  98. ;*
  99. ;\***************************************************************************/
  100.  
  101. GLOBAL  LANG rfClose : _funct
  102.  
  103.  
  104.  
  105.  
  106. ;/***************************************************************************\
  107. ;*
  108. ;* Function:     int rfGetSize(rfHandle file, long *fileSize);
  109. ;*
  110. ;* Description:  Get the size of a file
  111. ;*
  112. ;* Input:        rfHandle file           handle of an open file
  113. ;*               ulong *fileSize         pointer to file size
  114. ;*
  115. ;* Returns:      MIDAS error code.
  116. ;*               File size is stored in *fileSize.
  117. ;*
  118. ;\***************************************************************************/
  119.  
  120. GLOBAL  LANG rfGetSize : _funct
  121.  
  122.  
  123.  
  124.  
  125. ;/***************************************************************************\
  126. ;*
  127. ;* Function:     int rfRead(rfHandle file, void *buffer, ulong numBytes);
  128. ;*
  129. ;* Description:  Reads binary data from a file
  130. ;*
  131. ;* Input:        rfHandle file           file handle
  132. ;*               void *buffer            reading buffer
  133. ;*               ulong numBytes          number of bytes to read
  134. ;*
  135. ;* Returns:      MIDAS error code.
  136. ;*               Read data is stored in *buffer, which must be large enough
  137. ;*               for it.
  138. ;*
  139. ;\***************************************************************************/
  140.  
  141. GLOBAL  LANG rfRead : _funct
  142.  
  143.  
  144.  
  145.  
  146. ;/***************************************************************************\
  147. ;*
  148. ;* Function:     int rfWrite(rfHandle file, void *buffer, ulong numBytes);
  149. ;*
  150. ;* Description:  Writes binary data to a file
  151. ;*
  152. ;* Input:        rfHandle file           file handle
  153. ;*               void *buffer            pointer to data to be written
  154. ;*               ulong numBytes          number of bytes to write
  155. ;*
  156. ;* Returns:      MIDAS error code
  157. ;*
  158. ;\***************************************************************************/
  159.  
  160. GLOBAL  LANG rfWrite : _funct
  161.  
  162.  
  163.  
  164.  
  165. ;/***************************************************************************\
  166. ;*
  167. ;* Function:     int rfSeek(rfHandle file, long newPosition, int seekMode);
  168. ;*
  169. ;* Description:  Seeks to a new position in file. Subsequent reads and writes
  170. ;*               go to the new position.
  171. ;*
  172. ;* Input:        rfHandle file           file handle
  173. ;*               long newPosition        new file position
  174. ;*               int seekMode            file seek mode, see enum rfSeekMode
  175. ;*
  176. ;* Returns:      MIDAS error code
  177. ;*
  178. ;\***************************************************************************/
  179.  
  180. GLOBAL  LANG rfSeek : _funct
  181.  
  182.  
  183.  
  184.  
  185. ;/***************************************************************************\
  186. ;*
  187. ;* Function:     int rfGetPosition(rfHandle file, long *position);
  188. ;*
  189. ;* Description:  Reads the current position in a file
  190. ;*
  191. ;* Input:        rfHandle file           file handle
  192. ;*               long *position          pointer to file position
  193. ;*
  194. ;* Returns:      MIDAS error code.
  195. ;*               Current file position is stored in *position.
  196. ;*
  197. ;\***************************************************************************/
  198.  
  199. GLOBAL  LANG rfGetPosition : _funct
  200.  
  201.  
  202.  
  203.  
  204. ;/***************************************************************************\
  205. ;*
  206. ;* Function:     int rfFileExists(char *fileName, int *exists);
  207. ;*
  208. ;* Description:  Checks if a file exists or not
  209. ;*
  210. ;* Input:        char *fileName          file name, ASCIIZ
  211. ;*               int *exists             pointer to file exists status
  212. ;*
  213. ;* Returns:      MIDAS error code.
  214. ;*               *exists contains 1 if file exists, 0 if not.
  215. ;*
  216. ;\***************************************************************************/
  217.  
  218. GLOBAL  LANG rfFileExists : _funct
  219.  
  220.  
  221.  
  222.  
  223. ;/***************************************************************************\
  224. ;*       enum rfFunctIDs
  225. ;*       ---------------
  226. ;* Description:  ID numbers for raw file I/O functions
  227. ;\***************************************************************************/
  228.  
  229. ENUM    rfFunctIDs \
  230.         ID_rfOpen = ID_rf, \
  231.         ID_rfClose, \
  232.         ID_rfGetSize, \
  233.         ID_rfRead, \
  234.         ID_rfWrite, \
  235.         ID_rfSeek, \
  236.         ID_rfGetPosition, \
  237.         ID_rfFileExists
  238.  
  239.  
  240. ;* $Log: rawfile.inc,v $
  241. ;* Revision 1.3  1997/01/16 18:41:59  pekangas
  242. ;* Changed copyright messages to Housemarque
  243. ;*
  244. ;* Revision 1.2  1996/05/30 22:38:46  pekangas
  245. ;* no changes?
  246. ;*
  247. ;* Revision 1.1  1996/05/22 20:49:33  pekangas
  248. ;* Initial revision
  249. ;*